﻿@using NigiriClub.WebUI.Models
@model NigiriClub.WebUI.Models.FileModel

@{
    Game game;
    using (var db = new Entities())
    {
        var account = db.Account.FirstOrDefault(u => u.Name == User.Identity.Name);
        game = account == null ? null : db.Game.FirstOrDefault(n => n.ReviewerId == account.Id && !n.IsReviewed);
    }
}

@if (game != null)
{
    using (Html.BeginForm("UploadReviewedSgf", "Games", FormMethod.Post,
    new { enctype = "multipart/form-data" }))
    { 
        @Html.AntiForgeryToken()
        <fieldset>
            <legend>Загрузить партию</legend>
            <table class="table table-striped table-hover ">
                <tbody>
                    @Html.Partial("_GameRow", new Game(game))
                </tbody>
            </table>
            <span class="input-group">
                <span class="input-group-btn">
                    <span class="file-input btn btn-primary btn-file btn-xs">Выбрать партию
    @Html.TextBoxFor(model => model.file, new { type = "file", accept = ".sgf", @required = "true" })
                    </span>
                </span>
                <input type="text" class="form-control" readonly>
            </span>

            <button type="submit" class="btn btn-primary btn-xs">Загрузить</button>
        </fieldset>
    }
}

